package com.ylcy.ads.notification;

import android.app.Notification;
import android.app.PendingIntent;

import androidx.core.app.NotificationCompat;

import com.ylcy.ads.R;
import com.ylcy.ads.config.ENV;

public class NotificationService {
    public static void send(String text, long time, PendingIntent pi){
        //创建Notification，传入Context和channelId
        Notification notification = new NotificationCompat.Builder(ENV.context, "alarm")
                .setAutoCancel(true)
                .setContentTitle("打卡提醒")
                .setContentText(text)
                .setWhen(time)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentIntent(pi)
                //在build()方法之前还可以添加其他方法
                .build();

        ENV.nm.notify(1, notification);
    }

}
